<template>
  <div class="containet">
    <div class="app-containet">
      车形管理
      <el-form ref="form" label-width="80px" class="qqqq">
        <el-row type="flex" justify="space-between">
          <el-form-item label="车型编号" class="www">
            <el-input placeholder="请选择车型编号" />
          </el-form-item>
          <el-form-item label="应载重量">
            <el-select placeholder="请选择应载重量">
              <el-option label="区域一" value="shanghai" />
            </el-select>
          </el-form-item>
          <el-form-item label="应载体积">
            <el-select placeholder="请输入应载体积" class="rr">
              <el-option label="区域一" value="shanghai" />
            </el-select>
          </el-form-item>
        </el-row>
        <el-form-item label="车辆类型" class="www" prop="name">
          <el-input placeholder="请选择车辆类型" />
          <div class="oo">
            <el-button type="danger">搜索</el-button>
            <el-button plain>重置</el-button>
          </div>

        </el-form-item>

      </el-form>
      <div class="xia">
        <el-button type="danger" @click="add">新增车型</el-button>
        <el-table
          :data="tableData"
          stripe
        >
          <el-table-column
            type="index"
            prop="date"
            label="序号"
          />
          <el-table-column
            prop="id"
            label="车型编号"
          />
          <el-table-column
            prop="name"
            label="车辆类型"
          />
          <el-table-column
            prop="num"
            label="车型数量"
          />
          <el-table-column
            prop="allowableLoad"
            label="应载重量（吨）"
          />
          <el-table-column
            prop="allowableVolume"
            label="应载体积（立方米）"
          />
          <el-table-column
            prop="measureLong"
            label="长（米）"
          />
          <el-table-column
            prop="measureWidth"
            label="宽（米）"
          />
          <el-table-column
            prop="measureHigh"
            label="高（米）"
          />
          <el-table-column
            fixed="right"
            label="操作"
            width="100"
          >
            <template slot-scope="scope">
              <el-button type="text" size="small" class="qqw" @click="pagingArr(scope.row.id)">删除</el-button>
              <el-button type="text" size="small" @click="handleClick">编辑</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="block" />
      </div>
    </div>
    <!-- 接收子组件的弹框显示 -->
    <quqwu :visible="visible" />
    <compile :visible="visible" />
  </div>
</template>
<script>
import Compile from './compile/compile.vue'
import quqwu from './quyq/quqwu.vue'
import { layoutAxios, paging } from '@/api/organic'
export default {
  name: 'Employee',
  components: { quqwu, Compile },

  data() {
    return {
      total: 0,
      visible: false,
      tableData: [],
      tableParams: {
        page: 1,
        pageSize: 5
      }

    }
  },
  created() {
    this.layoutForm()
  },
  methods: {
    // 新增加模态框
    add() {
      this.visible = true
    },
    // 编辑模态框
    handleClick() {
      this.visible = true
    },
    // 获取页面渲染数据详情
    async  layoutForm() {
      const res = await layoutAxios()
      // console.log(res)
      this.tableData = res.data.data
    },
    // 删除数据
    async pagingArr(id) {
      await paging(id)
      this.layoutForm()
      this.$message.success('删除成功')
    }

  }

}
</script>
<style scoped>
.qqqq{
  width: 100%;
  height: 150px;
  margin-top: 50px;

}
.www{
  width: 400px;
}
.oo{
  margin-top: 10px;
  margin-left: 100px;
}
.rr{
  margin-right: 30px;
}
.xia{
  margin: 10px;
  width: 100%;
  background-color: #f3f4f7;
  border: 1px solid #f3f4f7;
}
.block{
  text-align: center;
}
.qqw{
  color: #f78989;
}
</style>
